#ifndef __I2C2_H_
#define __I2C2_H_

#include "stdbool.h"
#include "stm32f4xx_conf.h"

#define I2C2_SCL_GPIO_PORT	 	 GPIOB
#define I2C2_SCL_GPIO_CLK	 	 RCC_AHB1Periph_GPIOB
#define I2C2_SCL	     		 GPIO_Pin_10
#define I2C2_SCL_AF		   		 GPIO_AF_I2C2
#define I2C2_SCL_SOURCE	    	 GPIO_PinSource10

#define I2C2_SDA_GPIO_PORT	 	 GPIOB
#define I2C2_SDA_GPIO_CLK	     RCC_AHB1Periph_GPIOB
#define I2C2_SDA			 	 GPIO_Pin_11
#define I2C2_SDA_AF	   			 GPIO_AF_I2C2
#define I2C2_SDA_SOURCE	     	 GPIO_PinSource11





u8 I2C2_Init(u8 OwnAddress1);
static uint32_t getI2C2TimeLimit(void);
int32_t I2C2WriteByte(uint8_t devAdder, uint16_t regAdder, bool is16BitRegAdder, uint8_t num);
static int32_t I2C2WriteMoreByte(uint8_t devAdder, uint16_t startRegAdder, bool is16BitRegAdder,uint8_t *buf,uint8_t bufSize);
int32_t I2C2ReadByte(uint8_t devAdder, uint16_t regAdder, bool is16BitRegAdder, uint8_t *num);
int32_t I2C2ReadTwoByte(uint8_t devAdder, uint16_t startRegAdder, bool is16BitRegAdder, uint8_t *buf, bool isAllowOverPage);
static int32_t I2C2ReadMoreByte(uint8_t devAdder, uint16_t startRegAdder, bool is16BitRegAdder,uint8_t *buf,uint8_t bufSize);


#endif
